home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
PTRQZ.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
891b
|
51 lines
/* ptrqz.c */
/*
When executed, what does this program print out to the CRT ?
NAME__________________________
*/
main()
{
int z, *pz, x, *px;
static int ar[] = { 1, 1, 3, 2, 2, 2, 7, 8, 3, 3 };
int *testval(), *result;
z=20; x=10;
pz = &z; px = &x;
result = testval(pz, px);
if( result == 0 )
printf("Values are equal\n");
else
printf("The largest value is %d\n", *result);
result = testval(&ar[1], &ar[2]);
if( result == 0 )
printf("Values are equal\n");
else
printf("The largest value is %d\n", *result);
z=5;
pz = &ar[--z]; px = &ar[++z];
result = testval(pz, px);
if( result == 0 )
printf("Values are equal\n");
else
printf("The largest value is %d\n", *result);
}
/*
Testval() -
*/
int *testval(x,y)
int *x, *y;
{
if( *x > *y )
return(x);
else if( *y > *x )
return(y);
else
return(0);
}